vcVolumeDetector
vcVolumeDetector detects when components' geometries intersect with a defined box-like volume in the 3D world. The detection volume is a axis-aligned box in world coordinates, which is defined by two corner points. Simulation nodes can be included or excluded from detection using the NodeList.
See in: Overview
Module: vcCore
Parent: vcObject
Children -
Referenced by: vcWorld.createVolumeDetector()
Properties
Learn how to use properties here. The properties are also inherited from the parent class.
| Name | Type | Access | Description |
| Corner1 | vcVector | RW | Gets or sets the lower corner of box in World coordinate system. |
| Corner2 | vcVector | RW | Gets or sets the upper corner of box in World coordinate system. |
| HitCount | Integer | R | Gets the number of detected collisions with box. |
| NodeList | list | RW | Gets or sets a list of one or more nodes that can trigger a collision with box. |
| TestMethod | vcVolumeDetectorTestMethod | RW | Gets or sets test method for detecting collisions. See vcVolumeDetectorTestMethod constants for more information. |
| Transformation | vcMatrix | RW | Gets or sets the position matrix of box in World coordinate system. |
Methods
Learn how to use methods here. The methods are also inherited from the parent class.
| Name | Return Type | Parameters | Description |
| getHitFeature | vcFeature | Integer index | Returns a vcFeature at a given index in detected collisions list.See moreParameters: index (int): Index of the vcFeature in the collisions list. Returns: vcFeature: Feature at the given index. Exceptions: IndexError: When index is out of bounds in the collisions list. RuntimeError: When collisions list element at the given index is invalid. |
| getHitGeometrySet | vcGeometrySet | Integer index | Returns a vcGeometrySet at a given index in detected collisions list.See moreParameters: index (int): Index of the vcGeometrySet in the collisions list. Returns: vcGeometrySet: Geometry set at the given index. Exceptions: IndexError: When index is out of bounds in the collisions list. RuntimeError: When collisions list element at the given index is invalid. |
| getHitNode | vcNode | Integer index | Returns a vcNode at a given index in detected collisions list.See moreParameters: index (int): Index of the vcNode in the collisions list. Returns: vcNode: Node at the given index. Exceptions: IndexError: When index is out of bounds in the collisions list. RuntimeError: When collisions list element at the given index is invalid. |
| testAllCollisions | Boolean | Optional Keyword[tolerance = Real] | Detects all collisions of box with node list.See moreParameters: tolerance (float): Optional argument to detect collisions within a certain distance. By default, tolerance is zero. Returns: Boolean: True if a collision is detected, otherwise returns False. Exceptions: RuntimeError: When there is no license for Proximity Services. |
| testOneCollision | Boolean | Optional Keyword[tolerance = Real] | Detects the first collision of box with node list.See moreParameters: tolerance (float): Optional argument to detect collisions within a certain distance. By default, tolerance is zero. Returns: Boolean: True if a collision is detected, otherwise returns False. Exceptions: RuntimeError: When there is no license for Proximity Services. |
Example: Test Collisions By Using Volume Detector
"""This example shows how to test if any node collides with a volume.""" import vcCore as vc async def OnRun(): world = vc.getWorld() insideDetector = world.createVolumeDetector() insideDetector.Corner1 = vc.vcVector.new() insideDetector.Corner2 = vc.vcVector.new(102.0, 102.0, 102.0) all_nodes_entry = vc.vcNodeListEntry.new() all_nodes_entry.Node = world all_nodes_entry.Scope = vc.vcNodeListEntryScope.TREE all_nodes_entry.Type = vc.vcNodeListEntryType.INCLUDE insideDetector.NodeList = [all_nodes_entry] insideDetector.TestMethod = vc.vcVolumeDetectorTestMethod.INTERSECT insideHit1 = insideDetector.testAllCollisions() insideDetector.TestMethod = vc.vcVolumeDetectorTestMethod.CENTER_INSIDE insideHit2 = insideDetector.testAllCollisions() insideDetector.TestMethod = vc.vcVolumeDetectorTestMethod.INSIDE insideHit3 = insideDetector.testAllCollisions() print("--------") print("{} INTERSECT".format(insideHit1)) print("{} CENTER_INSIDE".format(insideHit2)) print("{} INSIDE".format(insideHit3))